# Maintainer: David Runge <dvzrv@archlinux.org>

_version=1_1_0
pkgname=oscpack
pkgver=1.1.0
pkgrel=3
pkgdesc="Open Sound Control packet manipulation library"
arch=(loong64 x86_64)
url="https://github.com/RossBencina/oscpack"
license=(MIT)
depends=(gcc-libs glibc)
provides=(liboscpack.so)
source=(
  $url/archive/release_${pkgver//./_}/$pkgname-release_${pkgver//./_}.tar.gz
  $pkgname-1.1.0-makefile.patch
)
sha512sums=('7a61a364cab4914c81e113d7aeee2b4accf5e560f500df6634232e0093f564ed4bb0ef8e87d2c8a18f245b0c7ec25f41e64f42f20a6654c22bb5c02aa253bbd0'
            '6a092a5eae7c52001175b59cb86bbbce0a8d565730edf38d8bcd18ed30ae1a0de4766a735a4a5702fa4210355b884a6f28991bfcba31b17be403d5c553c08b2c')
b2sums=('b52145df5dc8ce697496d8d44ff9435dd18a88ec5b6f43655c77260ccf6c4997abb51f1f11c8284de8ba4eb46de26513cfe9fdd90b146876b4e75cb3eac76a05'
        '083ba15957336a3cd0e208927ca9b5161a53f1b7b0b95f50c70adbbc089bfd677e10c5e9ca70416b50931d6e8f1438ee657aa534704aaa6ab8b2a56d869e273e')

prepare() {
  # fixing makefile to include -fPIC when compiling, honoring LDFLAGS during
  # linking and using DESTDIR during install
  patch -Np1 -d $pkgname-release_${pkgver//./_} -i ../$pkgname-1.1.0-makefile.patch
}

build() {
  make PREFIX=/usr -C $pkgname-release_${pkgver//./_}
}

package() {
  cd $pkgname-release_${pkgver//./_}
  make DESTDIR="$pkgdir/" PREFIX=/usr install
  install -vDm 644 {CHANGES,README,TODO} -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
